package com.example.demo.test1.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@TableName("test1")
public class Test1 implements Serializable,Comparable<Test1> {
    private static final long serialVersionUID = 5975843318325182133L;
    @TableId(value = "id", type = IdType.AUTO)
    private int id;
    private String first;
    private String second;
    @TableField("createTime")
    private Date createTime;

    public Test1(int id, String first, String second, Date createTime) {
        this.id = id;
        this.first = first;
        this.second = second;
        this.createTime = createTime;
    }

    public Test1() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirst() {
        return first;
    }

    public void setFirst(String first) {
        this.first = first;
    }

    public String getSecond() {
        return second;
    }

    public void setSecond(String second) {
        this.second = second;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Test1{" +
                "id=" + id +
                ", first='" + first + '\'' +
                ", second='" + second + '\'' +
                ", createTime=" + createTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Test1 test1 = (Test1) o;
        return getId() == test1.getId() &&
                Objects.equals(getFirst(), test1.getFirst()) &&
                Objects.equals(getSecond(), test1.getSecond());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getFirst(), getSecond());
    }

    @Override
    public int compareTo(Test1 o) {
        return 1;
    }
}
